﻿/*======================================================================================
	TASK 12:                                                                   {Arrays}
    Write a program that creates an array containing all letters from the alphabet (A-Z).
    Read a word from the console and print the index of each of its letters in the array. 
=======================================================================================*/

using System;

class ArrayContainingAllLettersOfAlphabet
{
    static void Main()
    {
        //A-Z:65-90	
        //a-z:97-122

        char[] alphabet = new char[52];

        for (int i = 0; i < 26; i++)
        {
            alphabet[i] = (char)(65 + i);
            alphabet[26 + i] = (char)(97 + i);
        }

        int smallLetters = 0;

        for (int i = 0; i < 26; i++)
        {
            smallLetters = i + 26;
            Console.WriteLine("alphabet[{0}]={1}      alphabet[{2}]={3}", i, alphabet[i], smallLetters, alphabet[smallLetters]);
        }

        //for (int i = 0; i < 52; i++)
        //{
        //    Console.WriteLine("alphabet[{0}]={1}", i, alphabet[i]);
        //}

        Console.WriteLine("\n");
        Console.WriteLine(new string('=', 40));
        Console.WriteLine();

        string word = "dcba";
        int ancii;
        int index;

        for (int i = 0; i < word.Length; i++)
        {
            ancii = (int)word[i];
            index = ancii - 65;
            if (ancii >= 97)
            {
                index = 26 + (ancii - 97);
            }
            Console.WriteLine("word[{0}]= {1} =alphabet[{2}]", i, word[i], index);
        }
    }
}

